home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cocktail / common.lha / common / c / Timer.c < prev    next >
C/C++ Source or Header  |  1992-08-18  |  403b  |  35 lines

  1. /* Timer.c */
  2. /* Bertram Vielsack, 07.03.88 */
  3.  
  4. #include "Timer.h"
  5.  
  6. long PrevTime = 0;
  7.  
  8.  
  9. long CpuTime ()
  10. {
  11. tms  b;
  12.  
  13. times (&b);
  14. return (b.uTime + b.sTime) * 20;
  15. }
  16.  
  17.  
  18. long StepTime ()
  19. {
  20.   long    ActTime;
  21.   long    DeltaTime;
  22.  
  23.   ActTime = CpuTime ();
  24.   DeltaTime = ActTime - PrevTime;
  25.   PrevTime = ActTime;
  26.   return DeltaTime;
  27. }
  28.  
  29.  
  30. void WriteStepTime (Text)
  31. char Text[];
  32. {
  33.   printf ("%s%d\n",Text,StepTime());
  34. }
  35.